package com.hxx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxx.entity.TrainStationEntity;
import com.hxx.mapper.TrainStationMapper;
import com.hxx.service.TrainStationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TrainStationServiceImpl extends ServiceImpl<TrainStationMapper, TrainStationEntity>
implements TrainStationService {

    @Autowired
    private TrainStationMapper trainStationMapper;
    @Override
    public Page<TrainStationEntity> listPage(Page<TrainStationEntity> page, TrainStationEntity entity) {
        return trainStationMapper.selectPage(page,new LambdaQueryWrapper<TrainStationEntity>()
                .like(entity.getName()!=null,TrainStationEntity::getName,entity.getName())
                .like(entity.getTrainCode()!=null,TrainStationEntity::getTrainCode,entity.getTrainCode())
        );
    }
}
